<?php
require('includes/top.php');

	$quest = $_POST['quest'];
	$name = $_POST['fname']." ".$_POST['lname'];
	$email = $_POST['email'];
	$company_name = $_POST['company_name'];
	$tele_no = $_POST['tel_code']."-".$_POST['phone'];
	$mob_no = $_POST['mob_code']."-".$_POST['mob'];
		
	$path = "files/";
	$path = $path . basename( $_FILES['upload_query']['name']); 
	if(move_uploaded_file($_FILES['upload_query']['tmp_name'], $path))
	{

		$insert_search_quest = mysql_query("insert into question_asked (`name`, `email`, `comp_name`, `tel`, `mob`, `upload_file`, `quest`) values ('$name', '$email', '$company_name', '$tele_no', '$mob_no', '$path', '$quest')");

			 if($insert_search_quest)
			 {
				header("location:ask_quest_ans.php?ques=".$_POST['quest']);
			 }
			 else
			 {
				 echo mysql_error();
			 }
	}
	else
	{
		$insert_search_quest1 = mysql_query("insert into question_asked (`name`, `email`, `comp_name`, `tel`, `mob`, `quest`) values ('$name', '$email', '$company_name', '$tele_no', '$mob_no', '$quest')");

			 if($insert_search_quest1)
			 {
				header("location:ask_quest_ans.php?ques=".$_POST['quest']);
			 }
			 else
			 {
				 echo mysql_error();
			 }
	}
ob_flush();
?>
 








